package com.tom.doc;

import lombok.Data;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Data
//indexName:索引库名字； type:类型
@Document(indexName = "hrm",type = "course")
public class CourseDoc {

    @Id // 文档的id
    private Long id;

    // text为分词，keyword不分词
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    // 使用人群
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String forUser;

    //课程类型
    private Long courseTypeId;

    // 等级
    @Field(type =FieldType.Keyword)
    private String gradeName;

    // 机构名字
    @Field(type =FieldType.Keyword)
    private String tenantName;

    // 机构id
    private Long tenantId;

    // 封面不需要倒排索引index = false
    @Field(type =FieldType.Keyword,index = false)
    private String pic;

    // 销售数量
    private Integer saleCount;

    // 浏览量
    private Integer viewCount;

    // 评论量
    private Integer commentCount;

    // 上线时间
    private Date onlineTime;

    // 是否收费
    @Field(type =FieldType.Keyword)
    private String chargeName;

    // 价格
    private Float price;

    // 旧价格
    private Float priceOld;
}
